# coding: utf-8
import cv2
import numpy as np
img = cv2.imread("/home/tan/Desktop/real_model.png") 
#img = cv2.imread("/home/tan/Desktop/back.PNG")
#img = cv2.imread("/home/tan/Desktop/real_model_.jpg")

# 缩放图像：最小边固定600，另外一边按比例缩放
height, width = img.shape[:2]
if height > width:
    resize_para = 600 / width
    height = height * resize_para
    width = 600
else:
    resize_para = 600 / height
    width = width * resize_para
    height = 600

size = (int(width), int(height))  
img = cv2.resize(img, size, interpolation=cv2.INTER_AREA)


def on_EVENT_LBUTTONDOWN(event, x, y, flags, param):
    if event == cv2.EVENT_LBUTTONDOWN:
        xy = "%d,%d" % (x, y)
        print(xy)
        cv2.circle(img, (x, y), 1, (255, 0, 0), thickness=-1)
        cv2.putText(img, xy, (x, y), cv2.FONT_HERSHEY_PLAIN,
                    1.0, (0, 0, 0), thickness=1)
        cv2.imshow("image", img)


cv2.namedWindow("image")
cv2.setMouseCallback("image", on_EVENT_LBUTTONDOWN)
cv2.imshow("image", img)

cv2.waitKey(0)
cv2.destroyAllWindow()